package com.taocore.top.title.service;

import java.util.List;
import java.util.logging.Logger;

import org.apache.commons.lang.StringUtils;

import com.taocore.top.title.domain.DiagnoseResult;

public class PropertyWordsChecker implements TitleChecker{

	static Logger _log = Logger.getLogger(PropertyWordsChecker.class.getName());
	
	private List<String> props;
	
	public PropertyWordsChecker(List<String> props)
	{
		this.props = props;
	}
	
	@Override
	public DiagnoseResult check(String title) {
		if (props == null)
		{
			return null;
		}
		for (String prop : props)
		{
			if (prop == null || StringUtils.containsIgnoreCase(title, prop))
			{
				return null;
			}
		}
		DiagnoseResult result = new DiagnoseResult();
		result.setMsg("标题中未包含任何属性词，不利于搜索。");
		return result;
	}

	
}
